<template>
	<view class="y-page-common page">
		<view class="card">
			<view class="">
				完成以下信息即可提交额度申请
			</view>
			<view class="">
				为了保证您的资金安全，请填写真实信息
			</view>
		</view>
		<view class="card form">
			<cell title='身份认证' mode="jump" :jumpBtn="['未完成', '已完成']" v-model="isIDAuth"
				jumpUrl="/pages/personal/IDAuth/IDAuth"></cell>
			<cell title='信息录入' mode="jump" :jumpBtn="['未完成', '已完成']" v-model="isInsertInfo"
				jumpUrl="/pages/personal/InsertInfo/InsertInfo"></cell>
			<cell title='影像采集' mode="jump" :jumpBtn="['未完成', '已完成']" v-model="isImgCollect"
				jumpUrl="/pages/personal/ImgCollect/ImgCollect"></cell>
			<!-- 兴农e贷个人“外部数据获取”不要 改为房产估值(如果选择抵押房产)-->
			<template v-if="isMortageProperty">

				<cell title='房产信息录入' mode="jump" jumpUrl="/pages/enterprise/house/index" v-if="lr" :jumpBtn="['待录入', '已录入']"
					jumpReIn="修改" v-model="isCheckProperty" required></cell>
				<cell title='房产信息录入' mode="jump" jumpUrl="/pages/enterprise/house/index" v-else :jumpBtn="['待录入', '不录入']"
					jumpReIn="修改" v-model="isCheckProperty" required></cell>
			</template>
		</view>
		<ReadmeBtn fixed="true" :readme="['个人贷款电子签名协议', '个人信息处理授权书(含人行征信授权)']" text="发起申请" @submit="submit"></ReadmeBtn>

	</view>
</template>

<script>
import cell from "@/components/cell.vue"
export default {
	components: {
		cell
	},
	data() {
		return {
			lr: '',
			isMortageProperty: false, // 用户是否抵押房产
			isIDAuth: false,
			isInsertInfo: false,
			isImgCollect: false,
			isCheckProperty: false
		}
	},
	onLoad() {
		this.isMortageProperty = uni.getStorageSync('isMortageProperty')
	},
	onShow() {
		this.isIDAuth = uni.getStorageSync('isIDAuth')
		this.isInsertInfo = uni.getStorageSync('isInsertInfo')
		this.isImgCollect = uni.getStorageSync('isImgCollect')
		this.lr = uni.getStorageSync('fcInfoInput') === '已录入'
		this.isCheckProperty = uni.getStorageSync('fcInfoInput')
	},

	methods: {
		toast(title) {
			uni.showToast({
				icon: "none",
				title,
			})
		},
		async submit() {
			if (!(this.isIDAuth && this.isInsertInfo && this.isImgCollect)) {
				uni.showToast({
					icon: "none",
					title: '有认证未完成',
					duration: 3000,
					position: 'top'
				})
				return
			}
			if (this.isMortageProperty && !this.isCheckProperty) {
				this.toast('请完成房产信息录入')
				return
			}
			await this.$myloading() // async
			uni.navigateTo({
				url: '/pages/personal/applyComplete'
			})
		},
	}
}
</script>

<style scoped lang="scss">
.page {
	width: 100%;
	height: 100%;
	position: absolute;

	.form {
		margin-bottom: 200rpx;
	}
}
</style>